{% extends 'index.html' %}


{% block content-left %}

{% if new_article %}
    <h3>文章<{{ new_article.title }}>已创建成功,点击<a href="{% url 'article' new_article.id  %}">此处</a>查看！</h3>

{% else %}

     <form action="{% url 'create_bbs' %}" method="POST"  enctype="multipart/form-data"> {% csrf_token %}

    <input type="text"  name="title" class="form-control" placeholder="文章标题...">
    <input type="file" name="head_image" />

     <textarea name="content" id="content">


     </textarea>
     <input type="submit" class="btn btn-info" value="发布" />
     </form>

{% endif %}


{% endblock %}


{% block bottom-js %}
   <script type="text/javascript" src="/static/plugins/tinymce/js/tinymce/tinymce.min.js"></script>
   <script type="text/javascript">
        tinymce.init({
            selector: "#content",
            theme: "modern",
            //width: 300,
            height: 400,
            plugins: [
                 "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
                 "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
                 "save table contextmenu directionality emoticons template paste textcolor"
           ],
           content_css: "/static/plugins/tinymce/js/tinymce/skins/lightgray/content.css",
           toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | l      ink image | print preview media fullpage | forecolor backcolor emoticons",
           style_formats: [
                {title: 'Bold text', inline: 'b'},
                {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
                {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
                {title: 'Example 1', inline: 'span', classes: 'example1'},
                {title: 'Example 2', inline: 'span', classes: 'example2'},
                {title: 'Table styles'},
                {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
            ]

        });
   </script>

{% endblock %}